<!DOCTYPE html>
<!-- saved from url=(0079)https://www.17sucai.com/preview/2/2016-07-26/jQuery-VerificationCode/index.html -->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>后台登录</title>
    <meta name="author" content="DeathGhost">
    <link rel="stylesheet" type="text/css" href="css/style.css" tppabs="css/style.css">
    <style>
        body {
            height: 100%;
            background-color: #16a085!important;
            overflow: hidden;
        }

        canvas {
            z-index: -1;
            position: absolute;
        }
        *{
            box-sizing:unset!important;

        }
    </style>

</head>
<body>
<canvas class="pg-canvas" width="1826" height="917"></canvas>
<dl class="admin_login">
    <dt>
        <strong>站点后台管理系统</strong>
        <em>Management System</em>
    </dt>
    <dd class="user_icon">
        <input type="text" placeholder="账号" class="login_txtbx" id="username">
    </dd>
    <dd class="pwd_icon">
        <input type="password" placeholder="密码" class="login_txtbx" id="userpassword">
    </dd>

    <dd>
        <input type="button" value="立即登陆" class="submit_btn" id="Login">
    </dd>
    <dd>
        <p>© 2015-2016 jq22 版权所有</p>
        <p>湘A6666666666666666666666</p>
    </dd>
</dl>


</body>
<script src="dist/js/include.js"></script>
<script src="css/verificationNumbers.js" tppabs="css/verificationNumbers.js"></script>
<script src="css/Particleground.js" tppabs="css/Particleground.js"></script>
<script>
    $(document).ready(function () {
        //粒子背景特效
        $('body').particleground({
            dotColor: '#5cbdaa',
            lineColor: '#5cbdaa'
        });

    });
    $().ready(function () {
        $('#Login').click(function () {
            if ($('#username').val() == "" || $('#userpassword').val() == "") {
                alert("用户名或密码不能为空！");
            } else {
                var allData = {
                    account: $('#username').val(),
                    password: $('#userpassword').val()
                };
                JSON.stringify(allData)
                $.ajax({
                    type: "POST",
                    url: "/user/admin/login",
                    data: JSON.stringify(allData),
                    beforeSend: function () {
                        $("#loading").css("display", "block"); //点击登录后显示loading，隐藏输入框
                        $("#Login").css("display", "none");
                    },
                    success: function (msg) {
                        $("#loading").hide(); //隐藏loading
                        if (msg.code == 0) {
//parent.tb_remove();
                            $.cookie('token', "Bearer " + msg.data.token);
                            parent.document.location.href = "index.html"; //如果登录成功则跳到管理界面

                        }
                        if (msg.code == 1) {
                            alert("登录失败！");
                        }
                    },
                    complete: function (data) {
                        $("#loading").css("display", "none"); //点击登录后显示loading，隐藏输入框
                        $("#Login").css("display", "block");
                    },
                    error: function (XMLHttpRequest, textStatus, thrownError) {
                    }
                });
            }
        });
    });
</script>
</html>